
CC = cl.exe
ASM = nasmw
LINK = link.exe

BINS = five.exe
SRCS = $(wildcard *.cpp)
ASMS = $(wildcard *.asm)
OBJS = $(SRCS:.cpp=.obj)
OBJS += $(ASMS:.asm=.obj)
COMMOBJS = cQiju.obj five_client.obj five_machine.obj UDPSocket.obj
LIBS = wsock32.lib windsoul/windsoul.lib

OBJFLAGS = /I"../comm" /I"./" /I"windsoul" /c
LINKFLAGS = 

all: windsoul $(BINS)

.PHONY: windsoul
windsoul:
	cd windsoul && make

five.exe:$(OBJS) $(COMMOBJS)
	$(LINK) $(LINKFLAGS) /out:"$@" $^ $(LIBS)

$(COMMOBJS):$(wildcard ../comm/*.cpp)
	$(CC) $(OBJFLAGS) $^
%.obj:%.cpp
	$(CC) $(OBJFLAGS) $<
%.obj:%.asm
	$(ASM) -o $@ -f win32 $<

clean:
	$(RM) -f *.exe *.obj *~